FROM ubuntu:18.04
RUN apt-get update
RUN apt-get upgrade --assume-yes
RUN apt-get install wget --assume-yes

#RUN wget http://www.cpan.org/src/5.0/perl-5.18.4.tar.gz
#RUN tar -xzf perl-5.18.4.tar.gz
#RUN apt-get install --assume-yes build-essential
#RUN cd perl-5.18.4 && ./Configure -des -Dprefix=$HOME/localperl
#RUN cd perl-5.18.4 && make
#RUN cd perl-5.18.4 && make install
#RUN perl -v
RUN apt-get install --assume-yes perl
RUN apt-get install --assume-yes apt-utils
RUN apt-get update && apt-get install -y sudo

#RUN wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
#RUN tar -xvzf Python-2.7.6.tgz
#RUN cd Python-2.7.6 && ./configure --with-ssl
#RUN cd Python-2.7.6 && make
#RUN cd Python-2.7.6 && make install
#RUN cd Python-2.7.6 && python --version
RUN apt-get install --assume-yes python

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone

ARG user=test

RUN useradd --create-home --no-log-init --shell /bin/bash ${user} \
    && adduser ${user} sudo \
    && echo "${user}:1" | chpasswd

ADD ./gn  /usr/bin/
ADD ./ninja  /usr/bin/

ADD ./install_modules.pl  /
# RUN chown --recursive test:test /install_modules.pl

#RUN whoami && ls -l /

RUN apt-get install --assume-yes mc re2c g++ bc zip u-boot-tools  rsync

#RUN wget https://github.com/ninja-build/ninja/archive/refs/tags/v1.3.4.tar.gz && mv v1.3.4.tar.gz ninja-1.3.4.tar.gz
#RUN ls -l && tar xvf ninja-1.3.4.tar.gz
#RUN cd ninja-1.3.4/ && ./bootstrap.py && cp ninja /usr/bin

#RUN wget -O gn http://storage.googleapis.com/chromium-gn/3fd43e5e0dcc674f0a0c004ec290d04bb2e1c60e
#RUN chmod +x gn && cp gn /usr/bin/

RUN apt-get install --assume-yes bison gcc make build-essential libc6-dev-i386 libncurses-dev wget coreutils diffstat  chrpath cpio
RUN apt-get install --assume-yes gawk git git-core help2man libtool libxml2-dev quilt sed subversion texi2html texinfo unzip flex libtinfo5 locales
RUN apt-get install --assume-yes diffstat unzip texinfo gcc-multilib build-essential chrpath socat python  python-pip   xz-utils debianutils iputils-ping  texlive
RUN pip install enum34

RUN update-alternatives --install /usr/bin/python  python /usr/bin/python2  2700
# RUN update-alternatives --install /usr/bin/python  python /usr/bin/python3  3600

ENV LANG C.UTF-8
# ENV LANGUAGE C.UTF-8 #可不配置
# ENV LC_ALL C>UTF-8 #可不配置

#RUN locale-gen en_US.UTF-8
#RUN export LANG=en_US.UTF-8
# ARG  LANG=en_US.UTF-8
#ARG  LANGUAGE="en_US.UTF-8"
#ARG  LANG=en_US:zh_CN.UTF-8
#ARG  LC_ALL=C
ENV  LC_ALL C

RUN perl /install_modules.pl 

USER  ${user}
#RUN cd /T750/openwrt && cp target/linux/mt6890/evb6890v1_64_cpe_nand/target.config .config
#RUN cd /T750/openwrt && make defconfig
#RUN cd /T750/openwrt && ./quecopen_make RG500LEU RG500LEUAAR01A01M4G STD
